home *** CD-ROM | disk | FTP | other *** search
/ MacWorld España 14 / macworld_es_14.iso / Share World 14 / Por Categorías / Comunicaciones / ZTerm 1.0.1 ƒ / ZTerm Docs / 5. Scripting < prev    next >
Text File  |  1995-10-21  |  4KB  |  99 lines

  1. 5.    Scripting
  2. A script is a sequence of commands.  ZTerm scripts are stored in TEXT files, which you can create with a text editor or most word processors (you must save the file in a TEXT only format).  A script may be run from the “Run a Script” menu command, or by a macro string or automatically run by the dialer when you connect to a service.  If a macro string starts with ® (Option-R) followed by the name of a script file, that script file will be run when you select that macro (from the Macro menu or with Command - number).  For example, I could set a macro label to “Read New” and set the macro string to “®readnew.zts” and when I select Read New from the Macros menu it would run the readnew.zts script file.  You can stop a running script by holding down the Command key and pressing the period key.  ZTerm looks in the ZTerm directory for script files.  It also looks in a folder called “ZTerm Scripts” in the ZTerm directory.
  3.  
  4. Logon Scripts
  5. When ZTerm connects to a service, it will look for a text file with the same name as the service with a “.zts” on the end.  For GEnie, it will look for a file called “GEnie.zts” in the ZTerm folder.  If it finds a file, it will run the script.  
  6.  
  7. String constants can use any form of quote:  "one", 'two', “three”, ‘four’
  8. Control characters in a string constant are specified with the ^ (carat) followed by the letter:  "^M" is control-M, which is the Return character.  Other control characters:
  9.  
  10. ^@ - NUL
  11. ^G - BELL
  12. ^H - Backspace
  13. ^I - Tab
  14. ^J - Line feed
  15. ^L - Form feed
  16. ^M - Carriage return
  17. ^Q - XON (resume data flow)
  18. ^S - XOFF (suspend data flow)
  19. ^[ - Escape
  20.  
  21.  
  22. Built-in variables
  23. $Account - string in the connection dialog
  24. $Password - string in connection dialog
  25. $Service - name of current service
  26. $Phone - phone number for current service
  27. $Date - in the short format
  28. $Time - in hours, minutes and seconds (hh:mm:ss)
  29. $hh_mm - time in hh_mm format (can be used to make a unique file name)
  30. $Day, $dd - day of month ($dd has zero fill)
  31. $mm - month
  32. $year
  33. $yy - low two digits of year
  34.  
  35. Script Commands
  36. Beep
  37. Beep <duration> -- if you are using the simple beep, you can give a duration.
  38.     Beep 4 ticks
  39.  
  40. Close capture -- close the capture file.
  41.  
  42. Display <string(s)> -- display text in the terminal window
  43.     Display “Connected at ” $time
  44.  
  45. Hangup -- hangup the modem (same as the menu command)
  46.  
  47. Open capture <capture file name> -- start capturing data to a file.
  48.     Open capture "GEnie.log"
  49.     Open capture “Internet.log.” $date “.” $hh_mm
  50.     (this would open a capture file named like “Internet.log.9/29/94.22_50”)
  51.  
  52. Send <string(s)>
  53.     Send “CIS^M” -- send the string (^M is a return)
  54.     Send $account “,” $password “^M” -- send multiple strings
  55.  
  56. Send break <duration>  -- send a break signal (default duration is 1/4 second)
  57.     Send break 20 ticks    -- break for 1/3 second
  58.  
  59. Wait <duration> -- pause a specified amount of time
  60.     Wait 2 seconds
  61.     Wait 40 ticks  -- a tick on the Mac is 1/60 second (40 ticks is 2/3 second)
  62.  
  63. Wait for quiet <duration> -- wait for no incoming data for the specified time.
  64.     Wait for quiet 4 seconds
  65.  
  66. Wait for prompt <string> -- check for the given string when data stops.  The word “for” is optional.
  67.     Wait for prompt “Username:”
  68.  
  69.  
  70. Comments -- these three forms make the rest of the line a comment:
  71. -- HyperCard style comments
  72. # MPW style comments
  73. ;  another comment character.
  74.  
  75.  
  76. Example Script
  77.  
  78. # GEnie.zts - Simple logon script for GEnie
  79. wait 2 seconds
  80.  
  81. # send hhh with short delay between them
  82. send “h”
  83. wait 10 ticks
  84. send “h”
  85. wait 10 ticks
  86. send “h”
  87.  
  88. # wait for GEnie to prompt for your user ID
  89. wait prompt "U#"
  90.  
  91. # send the account and password (from connection settings) with comma between them
  92. # and a return (^M) at the end.
  93. send $account “,” $password “^M”
  94.  
  95. # send beep to wake up - you are logged in now
  96. beep 5
  97. display "Connected at " $time
  98.  
  99.